# -*- coding: utf-8 -*-
import datetime
from app import db
from mongoengine.fields import StringField


class User(db.Document):
    email = db.EmailField(unique=True)
    password = db.StringField()
    active = db.BooleanField(default=True)
    isAdmin = db.BooleanField(default=False)
    timeStamp = db.DateTimeField(default=datetime.datetime.now())

    def __unicode__(self):
        return self.email

class Mov(db.Document):
    code = db.StringField()
    postTime = db.StringField()
    publisher = db.StringField()
    type = db.ListField(StringField())
    actress = db.ListField(StringField())
    director = db.StringField()
    length = db.StringField()
    path = db.StringField()
    manufacturer = db.StringField()
    movieName = db.ListField(StringField())
    def __unicode__(self):
        return self.movieName

class ReCommand(db.Document):
    code = db.StringField()
    postTime = db.StringField()
    publisher = db.StringField()
    type = db.ListField(StringField())
    actress = db.ListField(StringField())
    director = db.StringField()
    length = db.StringField()
    path = db.StringField()
    manufacturer = db.StringField()
    movieName = db.ListField(StringField())
    ReCommandTime = db.DateTimeField(default=datetime.datetime.now())
    email = db.EmailField()
    def __unicode__(self):
        return self.email